package com.smh.daimakuai;

public class Test {
    public static void main(String[] args) {
        {
            int a = 10;
            System.out.println(a);
            //用完后立刻回收
        }
        student s = new student();
        student s2 = new student();


        //System.out.println(a);
    }
    static class student{
        private String name;
        private int  age;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
        //构造代码块
        //将构造方法中的重复代码提取出来
        //优先于构造方法前执行
        //现在几乎不用了,不灵活
        {
            System.out.println("创建成功 ");
        }
        //静态代码块
        //类加载时执行\
        //用于数据加载
        static {
            System.out.println("静态代码块");
        }
        public student(String name, int age) {
            this.name = name;
            this.age = age;
        }

        public student() {
            System.out.println("asdad");
        }
    }
}
